<template>
	<div class="container">
		<h1>这是首页</h1>
		<button @click="onClick">跳转到测试页</button>
	</div>
</template>

<script setup>
import { ref, onMounted } from "vue";
import { useRouter } from "vue-router";
const router = useRouter();
const params = ref({
	name: "guotai",
	age: 999,
});
const str = "我是一个参数";
const onClick = () => {
	// router.push(`/test?params=${params.value}`);
	router.push({
		name: "Test",
		state: {
			age: "guotai",
			ag: "guotai",
		},
	});
};
const url =
	"https://m.maizuo.com/gateway?cityId=440300&pageNum=1&pageSize=10&type=1";
// const fetchData = () => fetch(url, {
//     headers: {
//         "X-host": "mall.film-ticket.film.list"
//     },
// }).then(res => res.json()).then(res => {
//     console.log(res);
// })
const fetchData = () =>
	fetch("data.json")
		.then((res) => res.json())
		.then((res) => {
			console.log(res);
		});
onMounted(() => {
	fetchData();
});
</script>

<style lang="scss" scoped></style>
